#include "dde-dock-interface.h"

#include <QApplication>
#include <QDateTime>
#include <QDebug>

static const QString DBbsDockDBusServer = "com.deepin.dde.Dock";
static const QString DBusDockDBusPath = "/com/deepin/dde/Dock";

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QString createdAt = "2024-03-29T08:26:50+00:00";
    // auto dt = QDateTime::fromString(createdAt, "yyyy-MM-ddTHH:mm:ss+zzz");
    auto dt = QDateTime::fromString(createdAt, Qt::ISODateWithMs);
    qDebug() << dt;

    DBusDockInterface interface(DBbsDockDBusServer,
                                DBusDockDBusPath,
                                QDBusConnection::sessionBus(), nullptr);

    qDebug() << interface.isValid();
    qDebug() << interface.geometry();

    auto geometry = interface.geometry_async();
    geometry.waitForFinished();
    qDebug() << geometry.isValid();
    qDebug() << geometry.isFinished();
    qDebug() << geometry.isError();
    if (geometry.isError()) {
        qDebug() << geometry.error().message();
    }
    qDebug() << geometry.value();

    auto uid = interface.uid();
    uid.waitForFinished();
    qDebug() << uid.isValid();
    qDebug() << uid.isFinished();
    qDebug() << uid.isError();
    if (uid.isError()) {
        qDebug() << uid.error().message();
    }
    qDebug() << uid.value();


    return 0;
}
